#!/bin/sh
#
# cloud-init remote
#
# chkconfig: 345 12 99
# description: Script to call udevadm to setup any links to devices already attached at instance launch

### BEGIN INIT INFO
# Provides: ec2blkdev
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: ec2blkdev
# Description: Script to call udevadm to setup any links to devices already attached at instance launch
### END INIT INFO

. /lib/lsb/init-functions

prog=/sbin/udevadm

start() {
    echo -n $"Starting ec2blkdev: "
    $prog trigger --action=change --subsystem-match=block
    retval=$?
    sleep 15 # Wait for EC2 API calls to complete
    echo
    return $retval
}

stop() {
    return
}

case "$1" in
    start)
        $1
        ;;
    stop)
        $1
        ;;
    *)
        echo $"Usage: $0 {start|stop}"
        exit 2
esac
exit $?
